​<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<head>
	<title>问题编辑页面</title>
	<link rel="stylesheet" type="text/css" href="${ctx}/res/css/addQuestion.css"></link>
	<script type="text/javascript" src="${ctx}/res/js/survey/surveyManagement/surveyDesign.js"></script>
</head>
<body>
	<input id="surveyEntity.surveyId" type="hidden"
		value="${survey.survey_Id }" />
	<div class="question-container">
	
		<!-- 问卷部分 -->
		<div class="question-title"><c:out value='${survey.survey_Name}'/></div>
		<div class="question-content">
			<p>背景介绍</p>
			<c:out value='${survey.remark }'/> <br>
			<p></p>
			<div style="text-align: right;">${survey.create_User }</div>
			<p></p>
			<p></p>
		</div>
		<form action="${ctx}/editQuestion/saveQuestion.do" method="post" id="questionForm">
			<!-- 向页面传值得隐藏域 -->
			<input type="hidden" name="survey_Id" value="${survey.survey_Id }" />
			<hr style="height: 1px; margin-top: 15px; margin-bottom: 15px;">
			<c:forEach items="${questions}" var="q" varStatus="list">
				<input type="hidden" name="questionList[${list.index}].id"
					value="${q.id}" />
				<input type="hidden" name="questionList[${list.index}].surveyId"
					value="${survey.survey_Id }" />
			</c:forEach>
			<c:forEach items="${questions}" var="q" varStatus="list">
			<!-- 问题的主体部分 -->	
				<div id="qs_${list.index}">
				<input type="hidden" name="questionList[${list.index}].createTime"
					value="${q.createTime}" />
				<input type="hidden" name="questionList[${list.index}].createUser"
					value="${q.createUser}" />
				
					<!-- 增加问题模块 -->
					<div style="text-align: right;">
						<div class="toolButton" onClick="addQuestion(this);"
							id="ad_${list.index}">增加问题</div>						
					</div>
					<!-- 问题编辑和删除 -->
					<div class="question-content" style="padding-left: 2px;">
						<div class="toolButton"
							onClick="editQuestion(qs_${list.index});" style="min-width: 30px;">Edit</div>
						<div class="toolButton"
							onClick="delQuestion(qs_${list.index});" style="min-width: 30px;">Del</div>
						<!-- 问题题目 -->
						<input type="hidden"
							name="questionList[${list.index}].questionOrder"
							value="${q.questionOrder}" /><c:out value='${q.questionContent }'/> <input
							type="hidden" name="questionList[${list.index}].questionContent"
							value="<c:out value='${q.questionContent }'/>" />
						
						 (
						<c:choose>
								<c:when test="${ q.questionType  == 1}">单选</c:when>
								<c:when test="${ q.questionType  == 2}">多选</c:when>
								<c:when test="${ q.questionType  == 3}">文本框</c:when>
								<c:when test="${ q.questionType  == 4}">文本域</c:when>
								<c:when test="${ q.questionType  == 5}">数字</c:when>
								<c:when test="${ q.questionType  == 6}">YN</c:when>
							</c:choose>)
					</div>
					<input name="questionList[${list.index}].questionType"
						type="hidden" value="${q.questionType }" />
					<!-- hidden 问题类型 -->
					<c:if test="${q.questionType  == 5 }">
						<!-- 问卷类型为数字 -->
						<div class="question-option">
							(最小值,最大值)(${q.validateRule}) <input name="validateRule"
								type="hidden" value="${q.validateRule}" />
								<input type="hidden"
										name="questionList[${list.index}].validateRule"
										value="${q.validateRule}" />
						</div>
					</c:if>
					<c:if test="${q.questionType  == 6 }">
						<!-- 问卷类型为数字 -->
						<div class="question-option">
							(默认值)(${q.validateRule}) <input name="validateRule"
								type="hidden" value="${q.validateRule}" />
								<input type="hidden"
										name="questionList[${list.index}].validateRule"
										value="${q.validateRule}" />
						</div>
					</c:if>
					<!-- 问题选项 -->
					 
						<c:forEach items="${q.questionOptionList}" var="qo"
							varStatus="qol">
							<c:if
								test="${ q.questionType==1 ||q.questionType==2 }">
								<div class="question-option">
									 ${qo.optionValue }.${qo.optionName }
									<input
										name="questionList[${list.index}].questionOptionList[${qol.index}].optionValue"
										type="hidden" value="${qo.optionValue }" /> <input
										name="questionList[${list.index}].questionOptionList[${qol.index}].optionName"
										type="hidden" value="${qo.optionName }" /> <input
										name="questionList[${list.index}].questionOptionList[${qol.index}].createTime"
										type="hidden" value="${qo.createTime }" /> <input
										name="questionList[${list.index}].questionOptionList[${qol.index}].createUser"
										type="hidden" value="${qo.createUser }" />
								</div>
							</c:if>
						</c:forEach>
					 
					<hr class='question-separator'></hr>
				</div>
			</c:forEach>
			<div style="text-align: right;" id="add">
				<div class="toolButton" onClick="addQuestion(this);" id="ad_last">增加问题</div>				
			</div>
			<!-- 保存和返回按钮 -->
			<div class="question-submit">
				<div class="toolButton" id="save_question">保存</div>
				<div class="toolButton" id="cancel">取消</div>
			</div>
		</form>
	</div>
	<!-- 增加问题模块 -->
	<div id="divMask" class="div-dialog-mask" style="display: none;"></div>
	<div id="divModelAddQuestion" class="div-dialog-modal-question"
		style="display: none;">
		<div class="modal-header">
			<h3 id="hhh">编辑问题</h3>
		</div>
		<div class="modal-body">
			<div class="question-content"
				style="padding: 10px 2px 2px 10px; margin-top: 3px; margin-bottom: 3px;">
				<textarea id="divModelAddQuestion_questionContent"
					style="width: 97%; height: 100px;" onfocus="textareaOnfocus(this)"
					onblur="textareaOnblur(this)">请输入问题内容</textarea>
			</div>
			<!-- 问题类型区域 -->
			<div class="question-content" id="surveyType"
				style="padding: 10px 2px 2px 10px; margin-top: 3px; margin-bottom: 3px;">
				<span>问题类型</span> &nbsp;&nbsp;&nbsp;&nbsp;<input type="radio"
					name="questionType" value="1" checked="checked" />单选 &nbsp;&nbsp;<input
					type="radio" name="questionType" value="2" />多选 &nbsp;&nbsp;<input
					type="radio" name="questionType" value="3" />文本框 &nbsp;&nbsp;<input
					type="radio" name="questionType" value="4" />文本域 &nbsp;&nbsp;<input
					type="radio" name="questionType" value="5" />数字 &nbsp;&nbsp;<input
					type="radio" name="questionType" value="6" />YN
			</div>
			<!-- 选项设置区域 -->
			<div id="divModelAddQuestion_optionSet" class="question-content"
				style="padding: 10px 2px 2px 10px; margin-top: 3px; margin-bottom: 3px;">
				<span>选项设置</span>
				<div class="toolButton" id="addOption">新增</div>
			</div>
			<div id="divModelAddQuestion_options"></div>
			
			<div id="divModelAddQuestion_quality"  class="question-option">
			<span>最小值</span><input type='text' name='optionText' id='minRule'/><br/>
			<span>最大值</span><input type='text' name='optionText' id='maxRule'/>
			</div>
			
			<div id="divModelAddQuestion_yn"  class="question-option">
			<input type='radio' name='optionText' value="Y" checked/>&nbsp;&nbsp;<span>Y</span><br/>
		    <input type='radio' name='optionText' value="N" />&nbsp;&nbsp;<span>N</span><br/>
		    </div>			
			
		</div>
		<div class="modal-footer">
			<div class="toolButton" id="divModelAddQuestion_save">确定</div>
			<div class="toolButton" id="divModelAddQuestion_cancel">取消</div>
		</div>
		<form id="submitcurrentpage" method="post" action="${ctx}/survey/surveyManagement/surveyList.do">
			<input type="hidden" name="pageType" value="lastest"/>	
		</form>
	</div>
</body>



